home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: mackeyes.chinalake.navy.mil!keyes
- From: Chip Keyes <keyes@vislab.navy.mil>
- Subject: Re: constant definitions in header files
- Message-ID: <DLyyp0.8nF@avalon.chinalake.navy.mil>
- X-Xxmessage-Id: <AD32ACCBD3015575@mackeyes.chinalake.navy.mil>
- X-Xxdate: Mon, 29 Jan 96 00:56:43 GMT
- Sender: usenet@avalon.chinalake.navy.mil (NAWS news admin)
- Organization: Naval Air Warfare Center
- X-Useragent: Version 1.1.3
- References: <3107699E.3EA5@mw_tx1.tca.fgg.eur.nl>
- Date: Tue, 30 Jan 1996 00:58:12 GMT
-
- In article <3107699E.3EA5@mw_tx1.tca.fgg.eur.nl> Stefan Nelwan,
- nelwan@mw_tx1.tca.fgg.eur.nl writes:
- >In article <3107699E.3EA5@mw_tx1.tca.fgg.eur.nl> Stefan Nelwan,
- nelwan@mw_tx1.tca.fgg.eur.nl writes:
- >I am curious about the common implementation of using const int's in
- >header files under
- >different compilers. According to "The C++ programming language"
- >(Stroustrup), only
- >simple constants may be placed in header files. It is up to the compiler
- >to ensure no
- >redundant copies of those constants are generated.
- >
-
- Global consts have internal linkage, they are only visible within the
- file it isi defined in. Therefore each file will have its own copy of
- the constants defined in the included header file. Consts are a
- peculiarity because they are the only variable type that has internal
- linkage and yet can be made visible externally.
-